package com.ds.dsm;

import com.alibaba.fastjson.annotation.JSONField;
import com.ds.admin.db.nav.DatabaseNav;
import com.ds.bpm.plugins.nav.BPDManagerTree;
import com.ds.common.JDSException;
import com.ds.config.ResultModel;
import com.ds.dsm.nav.DSMInstNavTree;
import com.ds.enums.db.MethodChinaName;
import com.ds.esd.client.ESDClient;
import com.ds.esd.client.ESDFacrory;
import com.ds.esd.custom.annotation.CustomAnnotation;
import com.ds.esd.custom.layout.annotation.LayoutAnnotation;
import com.ds.esd.custom.module.annotation.DynLoadAnnotation;
import com.ds.esd.custom.module.annotation.ModuleAnnotation;
import com.ds.esd.custom.nav.annotation.NavFoldingTreeViewAnnotation;
import com.ds.esd.custom.nav.annotation.NavGalleryAnnotation;
import com.ds.esd.custom.nav.annotation.NavTreeViewAnnotation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/dsm/nav/")
@NavGalleryAnnotation
@LayoutAnnotation(transparent = false)
@MethodChinaName(cname = "DSM导航")

public class IndexNav {


    @CustomAnnotation(hidden = true, pid = true)
    public String projectVersionName;


    @MethodChinaName(cname = "DSM建模")
    @RequestMapping(method = RequestMethod.POST, value = "DSMInstNavTree")
    @NavTreeViewAnnotation
    @DynLoadAnnotation
    @ModuleAnnotation(imageClass = "spafont spa-icon-conf", caption = "DSM建模", index = 1)
    @ResponseBody
    public ResultModel<DSMInstNavTree> getDSMInstNavTree(String projectVersionName) {
        return new ResultModel<DSMInstNavTree>();
    }


    @MethodChinaName(cname = "流程配置")
    @RequestMapping(method = RequestMethod.POST, value = "BPDManagerTree")
    @NavFoldingTreeViewAnnotation
    @ModuleAnnotation(imageClass = "spafont spa-icon-settingprj", caption = "流程配置", index = 2, cache = false)
    @ResponseBody
    public ResultModel<BPDManagerTree> getBPMManager(String projectVersionName) {
        return new ResultModel<BPDManagerTree>();
    }

    @MethodChinaName(cname = "数据库")
    @RequestMapping(method = RequestMethod.POST, value = "DatabaseNav")
    @NavFoldingTreeViewAnnotation
    @ModuleAnnotation(imageClass = "iconfont iconchucun", caption = "数据库", index = 3, cache = false)
    @ResponseBody
    public ResultModel<DatabaseNav> getDatabaseNav(String projectVersionName) {
        return new ResultModel<DatabaseNav>();
    }


    public String getProjectVersionName() {
        return projectVersionName;
    }

    public void setProjectVersionName(String projectVersionName) {
        this.projectVersionName = projectVersionName;
    }

    @JSONField(serialize = false)
    public ESDClient getEsdClient() throws JDSException {

        ESDClient client = ESDFacrory.getESDClient();

        return client;
    }
}
